import { Tabs, Form, Modal, Input, Button, Select, message } from 'antd';
import React, { useState, useEffect } from 'react';
import { history } from '@/.umi/core/history';
import request from '@/http';
import { Link } from 'react-router-dom';
import All_style from '../../index.less';
const { Option } = Select;

const Modify = () => {
  const [formObject] = Form.useForm();
  const loadData = async () => {
    const datas = await formObject.validateFields();
    console.log(datas.studentEmail);
    //获取用户和请假申请的基本信息
    const result: any = await request.post('/information/student/updateEmail', {
      studentEmail: datas.studentEmail,
    });
    if (result.success) {
      message.success('邮箱修改成功');
      window.history.back();
    }
  };
  return (
    <div className={All_style.box}>
      <Form
        name="Modify"
        form={formObject}
        // initialValues={}
        preserve={false}
      >
        <Form.Item name={'studentEmail'} label="邮箱地址">
          <Input
            type="email"
            placeholder="邮箱地址"
            style={{ width: 400 }}
            required
          ></Input>
        </Form.Item>

        <div style={{ clear: 'both', marginLeft: 100 }}>
          <Button
            type={'primary'}
            onClick={loadData}
            className={All_style.button}
          >
            确认修改
          </Button>
          <Link to="/Student/PersonalManagement/index">
            <Button className={All_style.button2}>取消</Button>
          </Link>
        </div>
      </Form>
    </div>
  );
};
export default Modify;
